{% extends 'page_framework.html' %}

{% block css %}
    <style>
        .table > tbody > tr > td {padding:2px;}
    </style>
{% endblock %}

{% block body %}
    <div class="row" style="padding:0 3%">
        <div class="ibox float-e-margins">
            <div class="ibox-content">
                <table class="table table-bordered">
                    <thead>
                        <tr style="padding: 2px">
                            <th style="text-align: center">序号</th>
                            <th style="text-align: center">导航名称</th>
                            <th style="text-align: center">菜单名称</th>
                            <th style="text-align: center">link名称</th>
                            <th style="text-align: center">link</th>
                            <th style="text-align: center">排序</th>
                            <th style="text-align: center">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for item in pageData %}
                            <tr style="text-align: center;height: 25px">
                                <td style="display: none" id="td_id">{{ item.id }}</td>
                                <td style="display: none;" id="td_nav_id">{{ item.menu.nav.id }}</td>
                                <td style="display: none;" id="td_menu_id">{{ item.menu.id }}</td>
                                <td id="td_num"></td>
                                <td id="td_navName">{{ item.menu.nav.name }}</td>
                                <td id="td_menuName">{{ item.menu.name }}</td>
                                <td id="td_name">{{ item.name }}</td>
                                <td id="td_link">{{ item.link }}</td>
                                <td id="td_order">{{ item.order }}</td>
                                <td>
                                    <a style="height: 20px;font-size: 8px;padding-top: 2px;padding-bottom: 1px" class="btn btn-info" onclick="del(this)">删除</a>&nbsp;&nbsp;
                                    <a style="height: 20px;font-size: 8px;padding-top: 2px;padding-bottom: 1px" class="btn btn-info" onclick="modify(this)">修改</a>
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
            <div class="ibox-content">
                <form id="form" class="form-horizontal" method="POST" action="/nav/configItem/add">
                    <input style="display: none" name="id">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">选择导航</label>
                        <div class="col-sm-8">
                            <select name="nav_id" class="form-control" onchange="change_nav(this)">
                                <option disabled="disabled" selected="selected">--选择导航--</option>
                                {% for item in navData %}
                                    <option value="{{ item.id }}">{{ item.name }}</option>
                                {% endfor %}
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">选择菜单</label>
                        <div class="col-sm-8">
                            <select name="menu_id" class="form-control" onchange="change_menu(this)">
                                <option disabled="disabled" selected="selected">--选择菜单--</option>
                                {% for item in menuData %}
                                    <option value="{{ item.id }}">{{ item.name }}</option>
                                {% endfor %}
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">link名称</label>
                        <div class="col-sm-8">
                            <input name="name" placeholder="link名称" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">排序号</label>
                        <div class="col-sm-8">
                            <input name="order" placeholder="排序号" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">link</label>
                        <div class="col-sm-8">
                            <input name="link" placeholder="link" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-5 col-sm-6">
                            <button id="add" class="btn btn-sm btn-info" type="submit">添加</button>
                            <button class="btn btn-sm btn-info">取消</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

{% endblock %}

{% block js %}
    <script src="../../static/js/configItem.js"></script>
{% endblock %}